package fibonacci3dphysics;

import toxi.geom.*;
import toxi.math.*;
import toxi.physics.*;
import toxi.physics.behaviors.*;
import toxi.physics.constraints.*;
import controlP5.*;
import processing.opengl.*;
import codeanticode.glgraphics.*;
import javax.media.opengl.*;

import processing.core.PApplet;


public class Fibonacci3DPhysics extends PApplet {

	/**
	 * 
	 */
	private static final long serialVersionUID = -8573579962609719403L;
	ControlP5 controlP5;
	ControlWindow cWindow;
	VerletPhysics physics;
	float seedSize = 30.0f;
	float dampingValue = 0.05f;
	float phi = 137.5f;
	float  c = 5.7f;
	
	public void setup() {
		size(800,600, GLConstants.GLGRAPHICS);
		initGui();
		initPhysics();
		
	}

	public void draw() {
		background(0);
		physics.update();
	}
	
	public void initGui()
	{
		controlP5 = new ControlP5(this);
		cWindow = controlP5.addControlWindow("controlP5Window", 100, 100, 400, 200);
		Controller phiSlider = controlP5.addSlider("phi", 0.0f,360.0f,137.5f,10,10,100,10);
		Controller cSlider = controlP5.addSlider("c", 1.0f,10.0f, 5.7f, 10, 30, 100, 10); 
		Controller fSlider = controlP5.addSlider("addFreq", 1,150, 25, 10, 50, 100, 10);
		Controller dSlider = controlP5.addSlider("dampingValue", 0.0f, 1.0f, 0.05f, 10, 70, 100, 10);
		Controller sSlider = controlP5.addSlider("seedSize", 1.0f, 144f, 30, 10, 90, 100, 10);
		
		phiSlider.moveTo(cWindow);
		cSlider.moveTo(cWindow);
		fSlider.moveTo(cWindow);
		dSlider.moveTo(cWindow);
		sSlider.moveTo(cWindow);
	}
	
	public void initPhysics()
	{
		physics = new VerletPhysics();
	}
	
	public static void main(String _args[]) {
		PApplet.main(new String[] { fibonacci3dphysics.Fibonacci3DPhysics.class.getName() });
	}
}
